Load Data and Packages

library(drc)
## Loading required package: MASS
## Warning: package 'MASS' was built under R version 4.1.2
## 
## 'drc' has been loaded.
## Please cite R and 'drc' if used for a publication,
## for references type 'citation()' and 'citation('drc')'.
## 
## Attaching package: 'drc'
## The following objects are masked from 'package:stats':
## 
##     gaussian, getInitial
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.1.2
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.1.2
## 
## Attaching package: 'dplyr'
## The following object is masked from 'package:MASS':
## 
##     select
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(MASS)

Population (Brazil)

aad <- read.csv("../models/data/aad.csv")
aad <- subset(aad, aad$Country == "Brazil")
aad <- subset(aad, !is.na(aad$Cutaneous.Leishmaniasis))
aad <- subset(aad, aad$Cutaneous.Leishmaniasis > 0)
aad <- subset(aad, !is.na(aad$Population))


mean_Population<- aad %>%
  group_by(Year) %>%
  summarise_at(vars(Population), list(name = mean))
mean_Population
## # A tibble: 18 × 2
##     Year   name
##    <int>  <dbl>
##  1  2001 43847.
##  2  2002 45426.
##  3  2003 46348.
##  4  2004 49244.
##  5  2005 48259.
##  6  2006 49831.
##  7  2007 53217.
##  8  2008 54053.
##  9  2009 54114.
## 10  2010 52696.
## 11  2011 55494.
## 12  2012 57312.
## 13  2013 59288.
## 14  2014 56854.
## 15  2015 57243.
## 16  2016 61279.
## 17  2017 61114.
## 18  2018 62421.
plot(mean_Population, main = "Population between 2001 and 2019", xlab = "Year", ylab = "Population")

small_df <- aad %>%
  dplyr::select("Cutaneous.Leishmaniasis", "Population")

small_df <- small_df %>%
  mutate(
    Population = cut(Population, breaks = seq(min(Population), max(Population), by = 75000), include.lowest = TRUE)
  ) %>%
  group_by(Population) %>%
  summarise(Cutaneous.Leishmaniasis = mean(Cutaneous.Leishmaniasis))

plot(small_df$Population, small_df$Cutaneous.Leishmaniasis)

ggplot(data = small_df, mapping = aes(Population, Cutaneous.Leishmaniasis)) +
  geom_point() +
  theme(axis.text.x = element_text(angle = 90))

Population (Colombia):

aad <- read.csv("../models/data/aad.csv")
aad <- subset(aad, aad$Country == "Colombia")
aad <- subset(aad, !is.na(aad$Cutaneous.Leishmaniasis))
aad <- subset(aad, aad$Cutaneous.Leishmaniasis > 0)
aad <- subset(aad, !is.na(aad$Population))


mean_Population<- aad %>%
  group_by(Year) %>%
  summarise_at(vars(Population), list(name = mean))
mean_Population
## # A tibble: 11 × 2
##     Year   name
##    <int>  <dbl>
##  1  2007 66785.
##  2  2008 42080.
##  3  2009 44313.
##  4  2010 44068.
##  5  2011 44255.
##  6  2012 46347.
##  7  2013 46646.
##  8  2014 47657.
##  9  2015 45938.
## 10  2016 43532.
## 11  2017 69874.
plot(mean_Population, main = "Population between 2001 and 2019", xlab = "Year", ylab = "Population")

small_df <- aad %>%
  dplyr::select("Cutaneous.Leishmaniasis", "Population")

small_df <- small_df %>%
  mutate(
    Population = cut(Population, breaks = seq(min(Population), max(Population), by = 25000), include.lowest = TRUE)
  ) %>%
  group_by(Population) %>%
  summarise(Cutaneous.Leishmaniasis = mean(Cutaneous.Leishmaniasis))

plot(small_df$Population, small_df$Cutaneous.Leishmaniasis)

ggplot(data = small_df, mapping = aes(Population, Cutaneous.Leishmaniasis)) +
  geom_point() +
  theme(axis.text.x = element_text(angle = 90))

Population(Peru):

aad <- read.csv("../models/data/aad.csv")
aad <- subset(aad, aad$Country == "Peru")
aad <- subset(aad, !is.na(aad$Cutaneous.Leishmaniasis))
aad <- subset(aad, aad$Cutaneous.Leishmaniasis > 0)
aad <- subset(aad, !is.na(aad$Population))


mean_Population<- aad %>%
  group_by(Year) %>%
  summarise_at(vars(Population), list(name = mean))
mean_Population
## # A tibble: 10 × 2
##     Year   name
##    <int>  <dbl>
##  1  2010 10771.
##  2  2011 10038.
##  3  2012 11572.
##  4  2013 12103.
##  5  2014 13226.
##  6  2015 14424.
##  7  2016 14222.
##  8  2017 17294.
##  9  2018 13767.
## 10  2019 13872.
plot(mean_Population, main = "Population between 2001 and 2019", xlab = "Year", ylab = "Population")

small_df <- aad %>%
  dplyr::select("Cutaneous.Leishmaniasis", "Population")

small_df <- small_df %>%
  mutate(
    Population = cut(Population, breaks = seq(min(Population), max(Population), by = 5000), include.lowest = TRUE)
  ) %>%
  group_by(Population) %>%
  summarise(Cutaneous.Leishmaniasis = mean(Cutaneous.Leishmaniasis))

plot(small_df$Population, small_df$Cutaneous.Leishmaniasis)

ggplot(data = small_df, mapping = aes(Population, Cutaneous.Leishmaniasis)) +
  geom_point() +
  theme(axis.text.x = element_text(angle = 90))

LST_Day:

aad <- read.csv("../models/data/aad.csv")
aad <- subset(aad, !is.na(aad$Cutaneous.Leishmaniasis))
aad <- subset(aad, aad$Cutaneous.Leishmaniasis > 0)
aad <- subset(aad, !is.na(aad$LST_Day))

mean_LST_Day<- aad %>%
  group_by(Year) %>%
  summarise_at(vars(LST_Day), list(name = mean))
mean_LST_Day
## # A tibble: 19 × 2
##     Year  name
##    <int> <dbl>
##  1  2001  29.6
##  2  2002  29.1
##  3  2003  29.3
##  4  2004  28.8
##  5  2005  29.1
##  6  2006  28.8
##  7  2007  29.0
##  8  2008  28.4
##  9  2009  28.3
## 10  2010  28.1
## 11  2011  27.5
## 12  2012  28.2
## 13  2013  28.0
## 14  2014  28.3
## 15  2015  28.8
## 16  2016  28.3
## 17  2017  27.8
## 18  2018  27.7
## 19  2019  23.8
plot(mean_LST_Day, main = "LST_Day between 2001 and 2019", xlab = "Year", ylab = "LST_Day")

small_df <- aad %>%
  dplyr::select("Cutaneous.Leishmaniasis", "LST_Day")

small_df <- small_df %>%
  mutate(
    LST_Day = cut(LST_Day, breaks = seq(min(LST_Day), max(LST_Day), by = 1), include.lowest = TRUE)
  ) %>%
  group_by(LST_Day) %>%
  summarise(Cutaneous.Leishmaniasis = mean(Cutaneous.Leishmaniasis))

plot(small_df$LST_Day, small_df$Cutaneous.Leishmaniasis)

ggplot(data = small_df, mapping = aes(LST_Day, Cutaneous.Leishmaniasis)) +
  geom_point()

aad <- read.csv("../models/data/aad.csv")
aad <- subset(aad, !is.na(aad$Cutaneous.Leishmaniasis))
aad <- subset(aad, aad$Cutaneous.Leishmaniasis > 0)
aad <- subset(aad, !is.na(aad$LST_Day))

library(dplyr)
library(ggplot2)

mean_LST_Day<- aad %>%
  group_by(Year) %>%
  summarise_at(vars(LST_Day), list(name = mean))
mean_LST_Day
## # A tibble: 19 × 2
##     Year  name
##    <int> <dbl>
##  1  2001  29.6
##  2  2002  29.1
##  3  2003  29.3
##  4  2004  28.8
##  5  2005  29.1
##  6  2006  28.8
##  7  2007  29.0
##  8  2008  28.4
##  9  2009  28.3
## 10  2010  28.1
## 11  2011  27.5
## 12  2012  28.2
## 13  2013  28.0
## 14  2014  28.3
## 15  2015  28.8
## 16  2016  28.3
## 17  2017  27.8
## 18  2018  27.7
## 19  2019  23.8
plot(mean_LST_Day, main = "Cutaneous Cases between 2001 and 2019", xlab = "Year", ylab = "Cases")

ggplot(data = aad, mapping = aes(LST_Day, Cutaneous.Leishmaniasis, xlab = "Land Surface Temperature", ylab = "Cases of Cutaenous Leishmaniasis per Thousand")) +
  geom_point() 

set.seed(22)
sample <- sample_n(aad, 500)

ggplot(data = sample, mapping = aes(LST_Day, Cutaneous.Leishmaniasis, xlab = "Land Surface Temperature", ylab = "Cases of Cutaenous Leishmaniasis per Thousand")) +
  geom_point() 

Precip

aad <- read.csv("../models/data/aad.csv")
aad <- subset(aad, !is.na(aad$Cutaneous.Leishmaniasis))
aad <- subset(aad, aad$Cutaneous.Leishmaniasis > 0)
aad <- subset(aad, !is.na(aad$Precip))

mean_Precip<- aad %>%
  group_by(Year) %>%
  summarise_at(vars(Precip), list(name = mean))
mean_Precip
## # A tibble: 19 × 2
##     Year  name
##    <int> <dbl>
##  1  2001 1335.
##  2  2002 1397.
##  3  2003 1362.
##  4  2004 1528.
##  5  2005 1447.
##  6  2006 1461.
##  7  2007 1546.
##  8  2008 1781.
##  9  2009 1826.
## 10  2010 1534.
## 11  2011 1728.
## 12  2012 1463.
## 13  2013 1635.
## 14  2014 1543.
## 15  2015 1428.
## 16  2016 1449.
## 17  2017 1586.
## 18  2018 1451.
## 19  2019 1115.
plot(mean_Precip, main = "Precip between 2001 and 2019", xlab = "Year", ylab = "Precip")

small_df <- aad %>%
  dplyr::select("Cutaneous.Leishmaniasis", "Precip")

small_df <- small_df %>%
  mutate(
    Precip = cut(Precip, breaks = seq(min(Precip), max(Precip), by = 100), include.lowest = TRUE)
  ) %>%
  group_by(Precip) %>%
  summarise(Cutaneous.Leishmaniasis = mean(Cutaneous.Leishmaniasis))

plot(small_df$Precip, small_df$Cutaneous.Leishmaniasis)

ggplot(data = small_df, mapping = aes(Precip, Cutaneous.Leishmaniasis)) +
  geom_point()

aad <- read.csv("../models/data/aad.csv")
aad <- subset(aad, !is.na(aad$Cutaneous.Leishmaniasis))
aad <- subset(aad, aad$Cutaneous.Leishmaniasis > 0)
aad <- subset(aad, !is.na(aad$Precip))

ggplot(data = aad, mapping = aes(Precip, Cutaneous.Leishmaniasis, xlab = "Land Surface Temperature", ylab = "Cases of Cutaenous Leishmaniasis per Thousand")) +
  geom_point() 

set.seed(22)
sample <- sample_n(aad, 500)

ggplot(data = sample, mapping = aes(Precip, Cutaneous.Leishmaniasis, xlab = "Land Surface Temperature", ylab = "Cases of Cutaenous Leishmaniasis per Thousand")) +
  geom_point() 

AvgRad:

aad <- read.csv("../models/data/aad.csv")
aad <- subset(aad, !is.na(aad$Cutaneous.Leishmaniasis))
aad <- subset(aad, aad$Cutaneous.Leishmaniasis > 0)
aad <- subset(aad, !is.na(aad$AvgRad))

mean_AvgRad<- aad %>%
  group_by(Year) %>%
  summarise_at(vars(AvgRad), list(name = mean))
mean_AvgRad
## # A tibble: 6 × 2
##    Year  name
##   <int> <dbl>
## 1  2014 0.974
## 2  2015 0.897
## 3  2016 0.829
## 4  2017 1.13 
## 5  2018 1.16 
## 6  2019 0.329
plot(mean_AvgRad, main = "AvgRad between 2001 and 2019", xlab = "Year", ylab = "AvgRad")

small_df <- aad %>%
  dplyr::select("Cutaneous.Leishmaniasis", "AvgRad")

small_df <- small_df %>%
  mutate(
    AvgRad = cut(AvgRad, breaks = seq(min(AvgRad), max(AvgRad), by = 1), include.lowest = TRUE)
  ) %>%
  group_by(AvgRad) %>%
  summarise(Cutaneous.Leishmaniasis = mean(Cutaneous.Leishmaniasis))

plot(small_df$AvgRad, small_df$Cutaneous.Leishmaniasis)

ggplot(data = small_df, mapping = aes(AvgRad, Cutaneous.Leishmaniasis)) +
  geom_point()

aad <- read.csv("../models/data/aad.csv")
aad <- subset(aad, !is.na(aad$Cutaneous.Leishmaniasis))
aad <- subset(aad, aad$Cutaneous.Leishmaniasis > 0)
aad <- subset(aad, !is.na(aad$AvgRad))

ggplot(data = aad, mapping = aes(AvgRad, Cutaneous.Leishmaniasis, xlab = "Land Surface Temperature", ylab = "Cases of Cutaenous Leishmaniasis per Thousand")) +
  geom_point() 

set.seed(22)
sample <- sample_n(aad, 500)

ggplot(data = sample, mapping = aes(AvgRad, Cutaneous.Leishmaniasis, xlab = "Land Surface Temperature", ylab = "Cases of Cutaenous Leishmaniasis per Thousand")) +
  geom_point() 

SWOccurrence:

aad <- read.csv("../models/data/aad.csv")
aad <- subset(aad, !is.na(aad$Cutaneous.Leishmaniasis))
aad <- subset(aad, aad$Cutaneous.Leishmaniasis > 0)
aad <- subset(aad, !is.na(aad$SWOccurrence))

mean_SWOccurrence<- aad %>%
  group_by(Year) %>%
  summarise_at(vars(SWOccurrence), list(name = mean))
mean_SWOccurrence
## # A tibble: 19 × 2
##     Year  name
##    <int> <dbl>
##  1  2001  34.8
##  2  2002  36.0
##  3  2003  35.6
##  4  2004  36.0
##  5  2005  35.6
##  6  2006  35.6
##  7  2007  35.9
##  8  2008  35.8
##  9  2009  35.8
## 10  2010  35.0
## 11  2011  35.0
## 12  2012  35.4
## 13  2013  35.7
## 14  2014  35.3
## 15  2015  36.1
## 16  2016  35.9
## 17  2017  35.3
## 18  2018  36.2
## 19  2019  37.1
plot(mean_SWOccurrence, main = "SWOccurrence between 2001 and 2019", xlab = "Year", ylab = "SWOccurrence")

small_df <- aad %>%
  dplyr::select("Cutaneous.Leishmaniasis", "SWOccurrence")

small_df <- small_df %>%
  mutate(
    SWOccurrence = cut(SWOccurrence, breaks = seq(min(SWOccurrence), max(SWOccurrence), by = 1), include.lowest = TRUE)
  ) %>%
  group_by(SWOccurrence) %>%
  summarise(Cutaneous.Leishmaniasis = mean(Cutaneous.Leishmaniasis))

plot(small_df$SWOccurrence, small_df$Cutaneous.Leishmaniasis)

ggplot(data = small_df, mapping = aes(SWOccurrence, Cutaneous.Leishmaniasis)) +
  geom_point()

aad <- read.csv("../models/data/aad.csv")
aad <- subset(aad, !is.na(aad$Cutaneous.Leishmaniasis))
aad <- subset(aad, aad$Cutaneous.Leishmaniasis > 0)
aad <- subset(aad, !is.na(aad$SWOccurrence))

ggplot(data = aad, mapping = aes(SWOccurrence, Cutaneous.Leishmaniasis, xlab = "Land Surface Temperature", ylab = "Cases of Cutaenous Leishmaniasis per Thousand")) +
  geom_point() 

set.seed(22)
sample <- sample_n(aad, 500)

ggplot(data = sample, mapping = aes(SWOccurrence, Cutaneous.Leishmaniasis, xlab = "Land Surface Temperature", ylab = "Cases of Cutaenous Leishmaniasis per Thousand")) +
  geom_point() 

Note: for the years 2018 and 2019 the forest variables are entirely missing so we will remove these years from this part of the analysis

pland_forest

aad <- read.csv("../models/data/aad.csv")
aad <- subset(aad, !is.na(aad$Cutaneous.Leishmaniasis))
aad <- subset(aad, aad$Cutaneous.Leishmaniasis > 0)
aad <- subset(aad, aad$Year < 2018)
aad$pland_forest <- ifelse(is.na(aad$pland_forest), 0, aad$pland_forest)


mean_pland_forest<- aad %>%
  group_by(Year) %>%
  summarise_at(vars(pland_forest), list(name = mean))
mean_pland_forest
## # A tibble: 17 × 2
##     Year  name
##    <int> <dbl>
##  1  2001  15.3
##  2  2002  15.5
##  3  2003  16.1
##  4  2004  17.0
##  5  2005  16.5
##  6  2006  17.0
##  7  2007  16.0
##  8  2008  15.8
##  9  2009  15.1
## 10  2010  17.4
## 11  2011  18.5
## 12  2012  18.5
## 13  2013  19.3
## 14  2014  19.0
## 15  2015  18.7
## 16  2016  18.8
## 17  2017  19.4
plot(mean_pland_forest, main = "pland_forest between 2001 and 2019", xlab = "Year", ylab = "pland_forest")

small_df <- aad %>%
  dplyr::select("Cutaneous.Leishmaniasis", "pland_forest")

small_df <- small_df %>%
  mutate(
    pland_forest = cut(pland_forest, breaks = seq(min(pland_forest), max(pland_forest), by = 1), include.lowest = TRUE)
  ) %>%
  group_by(pland_forest) %>%
  summarise(Cutaneous.Leishmaniasis = mean(Cutaneous.Leishmaniasis))

plot(small_df$pland_forest, small_df$Cutaneous.Leishmaniasis)

ggplot(data = small_df, mapping = aes(pland_forest, Cutaneous.Leishmaniasis)) +
  geom_point()

aad <- read.csv("../models/data/aad.csv")
aad <- subset(aad, !is.na(aad$Cutaneous.Leishmaniasis))
aad <- subset(aad, aad$Cutaneous.Leishmaniasis > 0)
aad <- subset(aad, !is.na(aad$pland_forest))

ggplot(data = aad, mapping = aes(pland_forest, Cutaneous.Leishmaniasis, xlab = "Land Surface Temperature", ylab = "Cases of Cutaenous Leishmaniasis per Thousand")) +
  geom_point() 

set.seed(22)
sample <- sample_n(aad, 500)

ggplot(data = sample, mapping = aes(pland_forest, Cutaneous.Leishmaniasis, xlab = "Land Surface Temperature", ylab = "Cases of Cutaenous Leishmaniasis per Thousand")) +
  geom_point() 

te_forest

library(dplyr)

aad <- read.csv("../models/data/aad.csv")
aad <- subset(aad, !is.na(aad$Cutaneous.Leishmaniasis))
aad <- subset(aad, aad$Cutaneous.Leishmaniasis > 0)
aad <- subset(aad, aad$Year < 2018)
aad$te_forest <- ifelse(is.na(aad$te_forest), 0, aad$te_forest)


mean_te_forest<- aad %>%
  group_by(Year) %>%
  summarise_at(vars(te_forest), list(name = mean))
mean_te_forest
## # A tibble: 17 × 2
##     Year     name
##    <int>    <dbl>
##  1  2001 2957377.
##  2  2002 2979479.
##  3  2003 3201279.
##  4  2004 3392664.
##  5  2005 3351710.
##  6  2006 3553386.
##  7  2007 3303576.
##  8  2008 3268245.
##  9  2009 3152663.
## 10  2010 2878924.
## 11  2011 2964732.
## 12  2012 3085098.
## 13  2013 3181605.
## 14  2014 3093772.
## 15  2015 3129279.
## 16  2016 3354560.
## 17  2017 3314219.
plot(mean_te_forest, main = "te_forest between 2001 and 2019", xlab = "Year", ylab = "te_forest")

small_df <- aad %>%
  dplyr::select("Cutaneous.Leishmaniasis", "te_forest")

small_df <- small_df %>%
  mutate(
    te_forest = cut(te_forest, breaks = seq(min(te_forest), max(te_forest), by = 2000000), include.lowest = TRUE)
  ) %>%
  group_by(te_forest) %>%
  summarise(Cutaneous.Leishmaniasis = mean(Cutaneous.Leishmaniasis))

plot(small_df$te_forest, small_df$Cutaneous.Leishmaniasis)

ggplot(data = small_df, mapping = aes(te_forest, Cutaneous.Leishmaniasis)) +
  geom_point() +
  theme(axis.text.x = element_text(angle = 90))

aad <- read.csv("../models/data/aad.csv")
aad <- subset(aad, !is.na(aad$Cutaneous.Leishmaniasis))
aad <- subset(aad, aad$Cutaneous.Leishmaniasis > 0)
aad <- subset(aad, !is.na(aad$te_forest))

ggplot(data = aad, mapping = aes(te_forest, Cutaneous.Leishmaniasis, xlab = "Land Surface Temperature", ylab = "Cases of Cutaenous Leishmaniasis per Thousand")) +
  geom_point() 

set.seed(22)
sample <- sample_n(aad, 500)

ggplot(data = sample, mapping = aes(te_forest, Cutaneous.Leishmaniasis, xlab = "Land Surface Temperature", ylab = "Cases of Cutaenous Leishmaniasis per Thousand")) +
  geom_point() 

enn_mn_forest:

aad <- read.csv("../models/data/aad.csv")
aad <- subset(aad, !is.na(aad$Cutaneous.Leishmaniasis))
aad <- subset(aad, aad$Cutaneous.Leishmaniasis > 0)
aad <- subset(aad, aad$Year < 2018)
aad$enn_mn_forest <- ifelse(is.na(aad$enn_mn_forest), 0, aad$enn_mn_forest)

mean_enn_mn_forest<- aad %>%
  group_by(Year) %>%
  summarise_at(vars(enn_mn_forest), list(name = mean))
mean_enn_mn_forest
## # A tibble: 17 × 2
##     Year  name
##    <int> <dbl>
##  1  2001  28.1
##  2  2002  28.9
##  3  2003  29.5
##  4  2004  31.3
##  5  2005  33.2
##  6  2006  35.8
##  7  2007  33.4
##  8  2008  35.4
##  9  2009  31.2
## 10  2010  33.8
## 11  2011  34.1
## 12  2012  36.3
## 13  2013  35.7
## 14  2014  38.4
## 15  2015  35.4
## 16  2016  36.1
## 17  2017  35.1
plot(mean_enn_mn_forest, main = "enn_mn_forest between 2001 and 2019", xlab = "Year", ylab = "enn_mn_forest")

small_df <- aad %>%
  dplyr::select("Cutaneous.Leishmaniasis", "enn_mn_forest")

small_df <- small_df %>%
  mutate(
    enn_mn_forest = cut(enn_mn_forest, breaks = seq(min(enn_mn_forest), max(enn_mn_forest), by = 25), include.lowest = TRUE)
  ) %>%
  group_by(enn_mn_forest) %>%
  summarise(Cutaneous.Leishmaniasis = mean(Cutaneous.Leishmaniasis))

plot(small_df$enn_mn_forest, small_df$Cutaneous.Leishmaniasis)

ggplot(data = small_df, mapping = aes(enn_mn_forest, Cutaneous.Leishmaniasis)) +
  geom_point() +
  theme(axis.text.x = element_text(angle = 90))

aad <- read.csv("../models/data/aad.csv")
aad <- subset(aad, !is.na(aad$Cutaneous.Leishmaniasis))
aad <- subset(aad, aad$Cutaneous.Leishmaniasis > 0)
aad <- subset(aad, !is.na(aad$enn_mn_forest))

ggplot(data = aad, mapping = aes(enn_mn_forest, Cutaneous.Leishmaniasis, xlab = "Land Surface Temperature", ylab = "Cases of Cutaenous Leishmaniasis per Thousand")) +
  geom_point() 

set.seed(22)
sample <- sample_n(aad, 500)

ggplot(data = sample, mapping = aes(enn_mn_forest, Cutaneous.Leishmaniasis, xlab = "Land Surface Temperature", ylab = "Cases of Cutaenous Leishmaniasis per Thousand")) +
  geom_point()